package com.oocl.euc.core.maintenance.model;
import com.oocl.euc.audit.AuditEntity;
import javax.persistence.*;
import java.util.Set;

@Entity
@Table(name = "PCRS_FUNCTIONS")
@SequenceGenerator(name = "SEQUENCE_GENERATOR", sequenceName = "FUNCTIONS_SEQUENCE", allocationSize = 1)
public class Function extends AuditEntity {

    @Column(name = "FUNCTION_NAME", nullable = false)
    private String functionName;

    @Column(name = "FUNCTION_DESC")
    private String functionDesc;

    @Column(name = "STATUS_RELATED")
    private boolean statusRelated;

    @Column(name = "ROLE_RELATED", nullable = false)
    private boolean roleRelated;

    @Column(name = "ACTIVE", columnDefinition = "int default 1", nullable = false)
    private boolean active;

    @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER, orphanRemoval = true)
    @JoinColumn(name = "FUNCTION_ID", referencedColumnName = "ID")
    private Set<FunctionAuth> functionAuthSet;


    public String getFunctionName() {
        return functionName;
    }

    public void setFunctionName(String functionName) {
        this.functionName = functionName;
    }

    public String getFunctionDesc() {
        return functionDesc;
    }

    public void setFunctionDesc(String functionDesc) {
        this.functionDesc = functionDesc;
    }

    public boolean isStatusRelated() {
        return statusRelated;
    }

    public void setStatusRelated(boolean statusRelated) {
        this.statusRelated = statusRelated;
    }

    public boolean isRoleRelated() {
        return roleRelated;
    }

    public void setRoleRelated(boolean roleRelated) {
        this.roleRelated = roleRelated;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Set<FunctionAuth> getFunctionAuthSet() {
        return functionAuthSet;
    }

    public void setFunctionAuthSet(Set<FunctionAuth> functionAuthSet) {
        this.functionAuthSet = functionAuthSet;
    }
}
